package com.naiterui.ehp.bs.cms.modules.sys.controller.inner;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.naiterui.ehp.bp.bo.cms.SysUserBO;
import com.naiterui.ehp.bp.security.annotation.AnonymousGetMapping;
import com.naiterui.ehp.bs.cms.modules.sys.entity.User;
import com.naiterui.ehp.bs.cms.modules.sys.service.IUserService;

import lombok.RequiredArgsConstructor;

/**
 * 内部系统用户
 *
 * @author yangfuya
 * @version 1.0
 * @date 2021/5/18 14:52
 **/
@RestController
@RequestMapping("inner/sys/user")
@RequiredArgsConstructor
public class InnerUserController {

    private final IUserService userService;

    /**
     * 通过ID获取用户信息
     */
    @AnonymousGetMapping("/info/{userId}")
    public SysUserBO info(@PathVariable("userId") Long userId) {
        User user = this.userService.getById(userId);
        return SysUserBO.builder().username(user.getUsername()).name(user.getName()).build();
    }
}
